//
//  DestinationCollectionViewCell.m
//  面包旅行
//
//  Created by Sunpeng on 15/11/4.
//  Copyright © 2015年 Sunpeng. All rights reserved.
//

#import "DestinationCollectionViewCell.h"

@implementation DestinationCollectionViewCell
-(instancetype)initWithFrame:(CGRect)frame{
    
    
    self = [super initWithFrame:frame];
    if (self) {
        [self addMessage];
        
        //nslog(@"=========");
    }
    
    return self;
}

-(void)addMessage{
    self.headerImageView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, WIDTH/2-10, WIDTH/2-10)];
    //self.headerImageView.backgroundColor = [UIColor lightGrayColor];
    self.headerImageView.layer.masksToBounds = YES;
    self.headerImageView.layer.cornerRadius = 8.0;
    self.headerImageView.layer.borderWidth = 1.0;
    self.headerImageView.layer.borderColor = [[UIColor whiteColor] CGColor];
    
    self.headerImageView.userInteractionEnabled = YES;
    [self.contentView addSubview:self.headerImageView];
    
    self.titelLabel = [[UILabel alloc]initWithFrame:CGRectMake(0.04*WIDTH, 0.21*HIGHT, 0.47*WIDTH, 40*XHIGHT)];
    //self.titelLabel.backgroundColor = [UIColor purpleColor];
    self.titelLabel.textColor = [UIColor whiteColor];
    self.titelLabel.font = [UIFont systemFontOfSize:14*XHIGHT];
    [self.contentView addSubview:self.titelLabel];
    
    
    
}
-(void)setLocateM:(locateModel *)locateM{
    
    _locateM = locateM;
    self.titelLabel.text = _locateM.name;
//    
//    UIImageView *imageView = [[UIImageView alloc]init];
//    imageView.backgroundColor =[UIColor colorWithRed:240 / 255.0 green:240 / 255.0 blue:240 / 255.0 alpha:1];
    
    [self.headerImageView sd_setImageWithURL:[NSURL URLWithString:_locateM.cover] placeholderImage:nil];
    
}
@end
